package com.demo.base.web.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.Contact;

/**
 * Created by ethan on 2017/9/14.
 */
@Configuration
public class BaseWebConfig {

    @Bean
    @ConditionalOnMissingBean(ApiKey.class)
    public ApiKey apiKey() {
        return new ApiKey("token", "token", "header");
    }

    @Bean
    @ConditionalOnMissingBean(ApiInfo.class)
    public ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("DEMO平台接口")
                .version("1.0.0")
                .description("在此添加文档说明")
                .termsOfServiceUrl("http://www.demo.com/")
                .contact(new Contact("DemoDev", "https://www.demo.com", "demo.dev@demo.com"))
                .build();
    }


}
